import myAxios from '@/utils/request'

export const loginApi = (data) => myAxios.post('/admins/login', data)

export const getUserInfoApi = (id) => myAxios.get(`/admins/user-info/${id}`)

export const updateUserInfoApi = (data) =>
  myAxios.put('/admins/update-info', data)

export const updatePwdApi = (data) => myAxios.put('admins/update-pwd', data)

export const addAdminApi = (data) => myAxios.post('/admins', data)

export const updateLockedApi = (id) => myAxios.put(`/admins/${id}`)

export const deleteAdminApi = (ids) =>
  myAxios.delete(`/admins`, {
    params: {
      ids: ids.join(',')
    }
  })

export const queryUserListApi = (params) =>
  myAxios.get('/admins/page', { params: params })

export const logoutApi = () => myAxios.post('admins/logout')
